<div class="container col-sm-12" ng-controller="ctrl">

  <span ng-init="api.pid='{{pid}}';api.mid='{{mid}}'"><a href="/project/index.html">首页</a>&nbsp;&gt;&nbsp;<a href="/module/index.html?pid={{pid}}">{{projectName}}</a>&nbsp;&gt;&nbsp;{{moduleName}}</span>
  <h3>
		<small class="text-info" ng-bind="'版本:'" ng-init="api.version=api.version||1;api.author='{{userName}}';">
		</small>
		<small ng-bind="api.version">
			<!-- <select style="width:50px;" ng-model="api.version" ng-change="change();" ng-init="versions=[1]">
				<option ng-repeat="v in versions" value="//v//" ng-bind="//v//"></option>
			</select> -->
		</small>
    &emsp;
		<small class="text-info" ng-bind="'更新日期:'+api.updateDate" ng-init="api.updateDate='{{updateDate}}'"></small>
	</h3>
  <form name="form" class="form-horizontal">
    <div class="form-group">
      <label for="name" class="col-sm-1 control-label required">接口名称</label>
      <div class="col-sm-5">
        <input ng-readonly="!editable" type="text" name="name" class="form-control" ng-model="api.name" validator="required" maxlength="50">
      </div>
      <label for="login" class="col-sm-1 control-label required">登录授权</label>
      <div class="col-sm-5">
        <select ng-readonly="!editable" name="login" class="form-control" ng-model="api.login" ng-init="api.login=api.login||'false'" validator="required">
          <option value="true">是</option>
          <option value="false">否</option>
        </select>
      </div>
    </div>
    <div class="form-group">
      <label for="url" class="col-sm-1 control-label required">请求路径</label>
      <div class="col-sm-5">
        <input ng-readonly="!editable" type="text" name="url" class="form-control" ng-model="api.url" placeholder="" validator="required,noSearch,path" maxlength="100">
      </div>
      <label for="method" class="col-sm-1 control-label required">请求方法</label>
      <div class="col-sm-5">
        <select ng-readonly="!editable" name="method" class="form-control" ng-model="api.method" ng-init="api.method='get'" validator="required">
          <option value="get">get</option>
          <option value="post">post</option>
          <option value="put">put</option>
          <option value="delete">delete</option>
        </select>
      </div>
    </div>

    <div class="form-group">
      <label for="inObject" class="col-sm-1 control-label">请求参数
        <br>
        <br><a href="/readme.html#mockjs" target="_blank">mockjs <br>示例</a>
      </label>
      <div class="col-sm-5">
        <textarea json-editor ng-readonly="!editable" name="inObject" contenteditable="" class="bg-white" ng-model="api.inObject" validator="json"></textarea>
      </div>
      <label for="inSchema" class="col-sm-1 control-label">
        <p>
          校验规则<br>
          参数说明
        </p>
        <a href="/readme.html#jsonschema" target="_blank">json schema <br>示例</a>
        <div style="margin-top:60px;" title="未出现错误则代表校验通过">校验结果
        </div>
      </label>
      <div class="col-sm-5">
        <textarea json-editor ng-readonly="!editable" name="inSchema" style="height:150px;" contenteditable="" class="bg-white" ng-model="api.inSchema" validator="json"></textarea>
        <pre name="inValidation" ng-bind="api.inValidation" style="height:150px;font-weight:700;" class="//api.inVerified?'text-success':'text-danger'//"></pre>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-1 control-label required">返回值
        <br>
        <br><a href="/readme.html#mockjs" target="_blank">mockjs <br>示例</a></label>
      <div class="col-sm-5">
        <textarea json-editor ng-readonly="!editable" name="outObject" contenteditable="" class="bg-white" ng-model="api.outObject" validator="required,json"></textarea>
      </div>
      <label for="outSchema" class="col-sm-1 control-label">
        <p>
          校验规则<br>参数说明
        </p>
        <a href="/readme.html#jsonschema" target="_blank">json schema <br>示例</a>
        <div style="margin-top:60px;" title="未出现错误则代表校验通过">校验结果 </div>
      </label>
      <div class="col-sm-5">
        <textarea json-editor ng-readonly="!editable" id="outSchema" style="height:150px;" contenteditable="" class="bg-white" ng-model="api.outSchema" name="outSchema" validator="json"></textarea>
        <pre ng-bind="api.outValidation" style="height:150px;font-weight:700;" class="//api.outVerified?'text-success':'text-danger'//"></pre>
      </div>
    </div>
    <div ng-if="message" class="alert alert-//message.level//" role="alert">
      <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
      <span class="sr-only">Error:</span> //message.text//
    </div>
    <div ng-if="editable" class="form-group">
          <label for="files" class="col-sm-1 control-label">上传附件</label>
          <div class="col-sm-5">


            <div id="container">
<div id="ossfile"></div>
                        	<a id="selectfiles" href="javascript:void(0);" class='btn'>选择文件</a>
                        	<a id="postfiles" href="javascript:void(0);" class='btn'>开始上传</a>
                <input type="hidden" id="filename" name="filename">
                        </div>
          </div>

        </div>
      <div ng-if="!editable" class="form-group">
          <label for="files" class="col-sm-1 control-label">附件</label>
          <div class="col-sm-5">
              <a href="javascript:void(0)" ng-click="downmyfile()" id="myfileurl" ng-bind="api.filename"></a>
              <a target="_blank" href="javascript:void(0)" id="down_a" style="display: none">下载</a>
          </div>
      </div>
    <div class="form-group">
      <label for="remark" class="col-sm-1 control-label">接口说明</label>
      <div class="col-sm-11">
        <textarea name="remark" id="remark" ng-readonly="!editable" style="height:50px;" placeholder="接口的描述信息"  ng-bind="api.remark" maxlength="1024"></textarea>
      </div>
    </div>
    <div class="form-group">
      <p class="pull-right text-success" ng-show="!!second">//second//秒后自动关闭，继续在当前模块下创建接口请点击&emsp;<a ng-click="stop();">取消</a>&emsp;</p>
    </div>
    <div ng-if="editable" class="form-group text-right">
      <textarea style="height:0;width:0;margin:0;padding:0;" id="json"></textarea>&emsp;
      <button type="button" class="btn btn-primary" ng-click="copy();">复制接口</button>&emsp;
      <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">粘贴接口</button>&emsp;
      <button validation-submit="form" ng-click="submit(form);" class="btn btn-large btn-warning">保存</button>
    </div>
  </form>
  <!-- Modal -->
  <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h4 class="modal-title" id="myModalLabel" ng-bind="modalTitle"></h4>
        </div>
        <textarea id="modalContent" style="width: 100%;height: 600px;" class="modal-body" ng-model="modalContent">
        </textarea>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal" ng-click="paste();">粘贴</button>
        </div>
      </div>
    </div>
  </div>
</div>
